More string exercises:
Start with the code below and use it to create the 3 methods described.
/**
* HWJ3 Write a description of class MoreStringMethods here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MoreStringMethods
{
/**
* will find the length of a given word.
* then it will print: The word ______ has ___ characters. Obviously filling in blank with the approp info
*/
public void printLength(String word)
{
}
/**
* this method takes in a string and prints
* out the last letter of the string
* like if they put in apple as word it would print out
* The last letter of apple is a
*/
public void findLast(String word)
{
}
/**
* This method will takes in a string and puts a "-" after the 3rd character
*/
public void wordSplit(String word)
{
}
/*
* This method will take in a string phrase and removes all characters from x to y
* assume x and y are within the length
* So removeLetters ("corndogs", 2,5) would print out cogs
*/
public void removeLetters(String phrase, int x, int y)
{
}
/*
* This method will take in a first and last name and a hw average and a project average and finds the grade
* The grade is made up of 40% hw, 60% projects. The name will be abbreviated as shown below
* So if findGrade("Jeff", "Borland", 90, 80) would print out Student JB has a 84.0 in the class
* The 84 is because 40%*90 + 80*.60 = 84.0
*/
public void findGrade(String firstName, String lastName, double hw, double project)
{
}
}
|